package com.game.eggscatcher.Screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.game.eggscatcher.EggsCatcher;
import com.game.eggscatcher.GameHelpers.AssetLoader;

public class SplashScreen implements Screen {
	
	private EggsCatcher game;
	private SpriteBatch batch;
	private float time = 0;
	private final int DELAY = 2;
	private OrthographicCamera cam;
	public SplashScreen(EggsCatcher game) {
		this.game = game;
		
		cam = new OrthographicCamera();
		cam.setToOrtho(true, 136, 204);
		batch = new SpriteBatch();
		batch.setProjectionMatrix(cam.combined);
	}

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
	    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	    
	    batch.begin();
	    AssetLoader.text.setScale(.15f, -.15f);
	    AssetLoader.text.setColor(Color.BLUE);
	    AssetLoader.text.draw(batch, "GL_Test_Game", 32, 50);
	    AssetLoader.handyText.setScale(.30f, -.30f);
	    AssetLoader.handyText.setColor(Color.BLACK);
	    AssetLoader.handyText.draw(batch, "Falling Eggs", 23, 80);
	    AssetLoader.handyText.setScale(.12f, -.12f);
	    AssetLoader.handyText.setColor(Color.MAROON);
	    AssetLoader.handyText.draw(batch, "Creator: Vu Trong Hung", 32, 130);
	    batch.end();
		time += delta;
		
		if (time >= DELAY) {
			game.setScreen(new GameScreen());
		}
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

}
